<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'addstudent.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">
	function isValid()
	{
		if(form0.studentID.value==""){
			alert("The studentId is null !!  please edit again !");
			form0.studentID.focus();
		}else if(form0.studentName==""){
			alter("The studentName is null !!  please edit again !");
			form0.studentName.focus();
		}else if(form0.passwd.value==""){
			alert("The passwd is null, please edit again !");
			form0.passwd.focus();
		}else if(form0.age.value==""){
			alert("The age is null,please edit again!");
			form0.age.focus();
		}else if(form0.department.value==""){
			alert("The department is null, please edit again!");
			form0.department.focus();
		}else{
			form0.submit();
		}
	}
	var AGE_FORMAT=/^[0-9]+$/
	function checkAge(){

			var age =document.getElementById("age").value;

	if (!AGE_FORMAT.test(age)) {
		alert("请输入年龄的正确格式！");
				form0.age.focus();
	}
	}


</script>
	</head>

	<body  bgcolor="#0094D4">
		<form name="form0" action="managerServlet?actioncode=addstudent" method="post">
			<table width="378" height="427" border="1" align="center">
				<tr align="center" bgcolor="#F3F3F3">
					<td colspan="3" bgcolor="#CCFFFF">
						添加学生
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td width="91" align="center" bgcolor="#EBEBEB">
						学生账号：
					</td>
					<td colspan="2">
						<input type="text" name="studentID" />
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB">
						登录密码：
					</td>
					<td colspan="2">
						<input name="passwd" type="password" />
						&nbsp;
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB">
						<p>
							姓名：
						</p>
					</td>
					<td colspan="2">
						<input name="studentName" type="text" />
						&nbsp;
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td height="40" align="center" bgcolor="#EBEBEB">
						性别：
					</td>
					<td colspan="2">
						男：
						<input type="radio" name="gender" checked="checked" value="男" />
						女：
						<input type="radio" name="gender" value="女" />
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB" >
						年龄：
					</td>
					<td colspan="2">
						<input name="age" type="text" onblur="checkAge()" id="age"/>
						&nbsp;
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB">
						班级：
					</td>
					<td colspan="2">
						<input type="text" name="classID" />
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB" name="">
						专业：
					</td>
					<td colspan="2">
						<select name="department">
							<option value="">
								—-请选择所在专业--
							</option>
							<option value="大数据与移动云计算">
								大数据与移动云计算
							</option>
							<option value="互联网与金融">
								互联网与金融
							</option>
						</select>
					</td>
				</tr>
				<tr bgcolor="#F3F3F3">
					<td align="center" bgcolor="#EBEBEB">
						状态：
					</td>
					<td colspan="2">
						可用：
						<input type="radio" name="permitted" value="1" checked="checked" />
						不可用：
						<input type="radio" name="permitted" value="0" />
					</td>
				</tr>
				<tr bgcolor="#EBEBEB">
					<td colspan="3" align="center">
						<table width="251" border="0">
							<tr>
								<td width="135">
									<input type="button" onclick="isValid()"  value="提交" />
								</td>
								<td width="100">
									<input type="reset" value="重置" />
								</td>
							</tr>
						</table>
					</td>
				</tr>
		  </table>

		</form>
	</body>
</html>
